<?php if (!defined('THINK_PATH')) exit(); /*a:1:{s:85:"F:\phpstudy_pro\WWW\www.danganguanli.com\public/../wcapps/admin\view\admin\index.html";i:1631263626;}*/ ?>
<!DOCTYPE html>

<html>

    <head>

        <meta charset="utf-8">

        <title>

            员工列表

        </title>

        <meta name="renderer" content="webkit">

        <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">

        <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">

        <meta name="apple-mobile-web-app-status-bar-style" content="black">

        <meta name="apple-mobile-web-app-capable" content="yes">

        <meta name="format-detection" content="telephone=no">

        <link href="/static/skin/nei.css" type="text/css" rel="stylesheet">

    </head>

</head>

<body onLoad="initPage(),list()">

<div id="LoadingBar"><img src="/static/images/load.gif" /></div>

<div class="contaiter">

	<div class="shuaxin" onclick="location.reload()" title="刷新">&#xe614;</div>

	<div class="nei01">

    	<div class="nei01_02">

        	<form class="layui-form" action="?" method="get">

               <div class="layui-form-item">

                <div class="layui-input-inline">

                 </div>

             </div>

           </form>

        </div>

    </div>

    <div class="nei02">

        <div class="nei02_01 l01">

       		<div class="nei02_01_01"><button class="layui-btn" onClick="openChuang('添加管理','<?php echo url('admin/admin/add'); ?>')">+ 添加管理</button></div>

            <div class="nei02_01_07">

            	<h3>

                	<i><label><input type="checkbox"><tt>✓</tt></label></i>

                	<span>管理员</span>

                    <span class="s01">身份</span>

                </h3>

                <div class="nei02_01_07_01" id="list1">

                </div>

                <div class="nei02_01_04_02" id="pageDemo"></div>

            </div>

        </div>

    </div>

</div>

<input type="hidden" id="pages1" name="pages1" value="1">

<script src="/static/js/jquery-1.10.2.min.js" type="application/javascript"></script>

<script src="/static/js/neijqtab.js" type="application/javascript"></script>

<script src="/static/js/xlayui/layui.js" charset="utf-8"></script>

<script>

function initPage(){

	var objLoading = document.getElementById("LoadingBar");

	if (objLoading != null){

		objLoading.style.display = "none";

		$(".contaiter").css("display","block");

	}

}

</script>

<script>

layui.use(['form','laypage', 'layer'], function(){ //独立版的layer无需执行这一句

  var $ = layui.jquery,form = layui.form(),laypage = layui.laypage, layer = layui.layer; //独立版的layer无需执行这一句

  form.on('select(field)', function(data){

  		field();

  });

});

function openChuang(title,url){

	field = $("#field").val()

	 var othis = $(this), method = othis.data('method');

    //多窗口模式，层叠置顶

      layer.open({

        type: 2 //此处以iframe举例

        ,title: title

        ,area: ['100%', '100%']

        ,shade: 0

        ,maxmin: true

        ,offset: [ //为了演示，随机坐标

          $(window).height()-$(window).height()

          ,$(window).width()-$(window).width()

        ]

        ,content: url

      });

}

function pageNum(id,total,pages){

	layui.use('laypage', function(){ //独立版的layer无需执行这一句

	var laypage = layui.laypage; //独立版的layer无需执行这一句

	laypage({

		cont: id //分页容器的id

		,pages: total //总页数

		,skin: '#5FB878' //自定义选中色值

		,curr: pages //当前页

		,skip: true //开启跳页

		,jump: function(obj, first){

		if(!first){

			layer.msg('第'+ obj.curr +'页',{time:300});

			if(id=="pageDemo") list(obj.curr);

		}

		}

		});

	});

}

function list(pages){

	$.ajax({

		type: "POST",

		async:false,

		contentType:"application/x-www-form-urlencoded; charset=UTF-8",

		url: "<?php echo url('admin/admin/index'); ?>",

		data: {pagesize:9,pages:pages,"act":"lists"},

		error:function(msg){

			alert("错误");

		},

		success:function(msg){

			 json = msg.data;

			 var html="";

			 for(var i=0; i<json.length; i++)

			 {
			   html += '<li><i><label><input type="checkbox" value="'+json[i].id+'"><tt>✓</tt></label></i><span>'+json[i].ma_n+'</span><span class="s01">'+json[i].lname+'</span><span class="s02 layui-btn layui-btn-nonebg"  onClick=openChuang("编辑管理员","/admin/admin/edit/id/'+json[i].id+'/")>&#xe617;</span><span class="s03 layui-btn layui-btn-nonebg-1" onclick=openDelete('+json[i].id+')>&#xe6f4;</span></li>';

			 }

			 $('#list1').html(html);

			 pageNum('pageDemo',msg.totalpage,pages);

			  if(pages>1)

			 	$("#pages1").val(msg.totalpage);

			 else

				$("#pages1").val(1);

		}

	});

}

function openDelete(id){

	layer.confirm('确定要删除本条信息吗，删除无法恢复?', {icon: 3, title:'删除提示框'}, function(index){

		var loading2 = layer.load();

		$.ajax({

			url:"<?php echo url('admin/admin/delete'); ?>",

			type:"POST",

			data:{id:id},

			dataType:"",

			success:function(json){

				layer.close(loading2);

				if(json==1){

					layer.alert("删除成功!");

					list($("#pages1").val());

				}else{

					layer.alert("删除失败",{time:1000});

				}

				layer.close(index);

			},

			error:function(res){

				alert('ajax错误!');

			}

		});		return false;

	});

}

</script>

</body>

</html>